-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop deleting cache images #1136
Stop deleting cache images #1136
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! Did we say we didn't need to guard this behind an API version @natalieparellano? I don't have a strong opinion. The delete is not in spec.
One doubt about this based on the motivation section in the RFC. How does it impact pack users? Do we need to advertise to users they need to delete or take care of the cache images saved in the registry? or do we need to create an issue on pack to think about this and if we want to offer some feature to manage the cache? No related directly to this conversation on slack but just wanted to keep track of it |
I think that is up to I would be 👍 holding this until |
@jabrown85 |
UPDATE: I requested to talk about it in the next working group |
As @natalieparellano pointed out in working group - we previously decided to gate this new behavior on platform api version @dlion. Let's do that for our platform and builder operators. |
Sure, I'll comment this PR whenever I open the spec PR so we can be in the same page |
94d0bbe
to
37ebe13
Compare
All right, after a bit of refactoring now the PR should be ready to be reviewed 😄
Thoughts are welcomed 😃 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dlion nice work! I made a few suggestions - LMK your thoughts :)
1396fc8
to
dc75380
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dlion thanks for your work on this! It looks good to me.
@jabrown85 did you want to have another look?
@dlion are you able to fix the DCO? |
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
…est" This reverts commit 17e646fc39602777a37977dd9416e59aa62f6d04. Signed-off-by: Domenico Luciani <dluciani@vmware.com>
…the deletion of the cache images Signed-off-by: Domenico Luciani <dluciani@vmware.com>
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
…ways set has enabled Signed-off-by: Domenico Luciani <dluciani@vmware.com>
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
Signed-off-by: Domenico Luciani <dluciani@vmware.com>
```go func Benchmark(b *testing.B) { mockController := gomock.NewController(b) fakeImageComparer := cacheMock.NewMockImageComparer(mockController) testLogger := cmd.DefaultLogger imageDeleter := NewImageDeleter(fakeImageComparer, testLogger, true) for i := 0; i < b.N; i++ { fakeOrigImage := fakes.NewImage("fake-image", "", local.IDIdentifier{ImageID: "fakeImage"}) fakeNewImage := fakes.NewImage("fake-image", "", local.IDIdentifier{ImageID: "fakeNewImage"}) fakeImageComparer.EXPECT().ImagesEq(fakeOrigImage, fakeNewImage).AnyTimes().Return(false, nil) imageDeleter.DeleteOrigImageIfDifferentFromNewImage(fakeOrigImage, fakeNewImage) } } ``` The code above produced this result: * without the go-subroutine ``` goos: darwin goarch: amd64 pkg: github.com/buildpacks/lifecycle/cache cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz Benchmark Benchmark-12 3501 8995839 ns/op PASS ``` * with the go-subroutine ``` goos: darwin goarch: amd64 pkg: github.com/buildpacks/lifecycle/cache cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz Benchmark Benchmark-12 3560 9133704 ns/op PASS ``` Speed increased by 1.53% ns/op Signed-off-by: Domenico Luciani <dluciani@vmware.com>
dc75380
to
0fb6d92
Compare
@natalieparellano there was a commit not signed-off, fixed it 😄 I think then we can merge 🎉 |
@natalieparellano Codecov failed again 🫠 we should reproduce what we have done with pack (buildpacks/pack#1809). |
* Remove deleteOrigImage function from the cache and relative test Signed-off-by: Domenico Luciani <dluciani@vmware.com> * Revert "Remove deleteOrigImage function from the cache and relative test" This reverts commit 17e646fc39602777a37977dd9416e59aa62f6d04. Signed-off-by: Domenico Luciani <dluciani@vmware.com> * Implemented a new component called cache deleter which takes care of the deletion of the cache images Signed-off-by: Domenico Luciani <dluciani@vmware.com> * Adjusted the name of the struct field Signed-off-by: Domenico Luciani <dluciani@vmware.com> * Move the imade deleter instatiation up to the main Signed-off-by: Domenico Luciani <dluciani@vmware.com> * Add parameter to enable/diable the deletion functionality, for now always set has enabled Signed-off-by: Domenico Luciani <dluciani@vmware.com> * Add feature guard based on the platformAPI version Signed-off-by: Domenico Luciani <dluciani@vmware.com> * Fixing some test titles Signed-off-by: Domenico Luciani <dluciani@vmware.com> * Introduce ImageComparer component Signed-off-by: Domenico Luciani <dluciani@vmware.com> * Add async go-subroutine to the delete call to speed up the process ```go func Benchmark(b *testing.B) { mockController := gomock.NewController(b) fakeImageComparer := cacheMock.NewMockImageComparer(mockController) testLogger := cmd.DefaultLogger imageDeleter := NewImageDeleter(fakeImageComparer, testLogger, true) for i := 0; i < b.N; i++ { fakeOrigImage := fakes.NewImage("fake-image", "", local.IDIdentifier{ImageID: "fakeImage"}) fakeNewImage := fakes.NewImage("fake-image", "", local.IDIdentifier{ImageID: "fakeNewImage"}) fakeImageComparer.EXPECT().ImagesEq(fakeOrigImage, fakeNewImage).AnyTimes().Return(false, nil) imageDeleter.DeleteOrigImageIfDifferentFromNewImage(fakeOrigImage, fakeNewImage) } } ``` The code above produced this result: * without the go-subroutine ``` goos: darwin goarch: amd64 pkg: github.com/buildpacks/lifecycle/cache cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz Benchmark Benchmark-12 3501 8995839 ns/op PASS ``` * with the go-subroutine ``` goos: darwin goarch: amd64 pkg: github.com/buildpacks/lifecycle/cache cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz Benchmark Benchmark-12 3560 9133704 ns/op PASS ``` Speed increased by 1.53% ns/op Signed-off-by: Domenico Luciani <dluciani@vmware.com> --------- Signed-off-by: Domenico Luciani <dluciani@vmware.com>
With this PR the cache will just override the original image with the new image without attempting to delete it first.
Resolves #803 and it partially resolves buildpacks/rfcs#268